<?php

class Welcome extends Controller {

	function Welcome()
	{
		parent::Controller();	
	}
	
	function index()
	{
        $data["action"] = site_url("welcome/login");
        $data["goto"] = site_url("manage");
		$this->load->view('welcome_message', $data);
	}

    function login(){
        $username = $this->input->post("username");
        $password = $this->input->post("password");

        $this->load->model("User");
        $ret = $this->User->auth($username, $password);
        $devids = $this->User->get_devids();
        $uid = $this->User->get_uid();

        if($ret !== true){
            $this->session->sess_destroy();
            // echo $this->lang->line("login_failed");
            echo "false";
        }else{
            $this->session->set_userdata(array(
                                             "username"=>$username,
                                             "uid"=>$uid,
                                             "devids"=>$devids,
                                             ));
            echo "true";
        }
    }
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */